#/* 
#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#Project: MyMANET - A Platform to Build Customized MANET's
#Developers: Ashwin Paranjpe, Santosh Vempala
#Georgia Institute of Technology, Atlanta, USA
#*/

#!/bin/sh
echo "
***** 
This script will try to remove the module and clean up files created by the module(if present). 
You might see some errors if these files do not exist. This is normal. 
***** 
"
PID=`cat config/update_ip.conf | awk '{ print $2 }'`
kill -15 $PID

bash firewall/flush_all.sh


cd ./src

rmmod manifold.ko
make clean


cd ../tools/raw

tar -cvf results.tar statlist_refined detailed_distance_log distance_log ../../config/*

#Delete config files
rm ./../../config/*

rm statlist
rm statlist_refined
rm distance_log
rm detailed_distance_log
rm sniff
sudo killall -9 inject
rm inject
rm statlist_web

echo "Enabling Network Manager..."
cd ..
cd ..

scripts/enable_nm_gui.sh

